<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
  <div region="center" style="padding:0px;border:0px">
  <t:datagrid name="dictGroupList" checkbox="false" fitColumns="true" title="耗材入库申请" actionUrl="consumeMeterialStockInController.do?datagrid" idField="id" fit="true" queryMode="group">
   <t:dgCol title="主键"  field="id"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="申请状态"  field="applyState_value" hidden="true"    queryMode="single"  width="100"></t:dgCol>
   <t:dgCol title="入库单号"  field="sheetNo"    queryMode="single"  width="100"></t:dgCol>
   <t:dgCol title="申请日期"  field="createDate"  query="true"  formatter="yyyy-MM-dd"   queryMode="single"  width="100"></t:dgCol>
   <t:dgCol title="申请人"  field="applyUser_realName"    queryMode="single"  width="80"></t:dgCol>
   <t:dgCol title="耗材名称"  field="meterial_name"   queryMode="single"  width="100"></t:dgCol>
   <t:dgCol title="型号"  field="meterial_model"   query="true" queryMode="single"  width="100"></t:dgCol>
   <t:dgCol title="入库数量"  field="inCount"   queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="单位"  field="unitName"   queryMode="single"  width="60"></t:dgCol> 
   <t:dgCol title="仓库地址"  field="houseAddress"   queryMode="single"  width="120"></t:dgCol> 
   <t:dgCol title="申请状态"  field="applyState_name"    queryMode="single"  width="80"></t:dgCol>
   <t:dgCol title="审核时间"  field="auditDate" formatter="yyyy-MM-dd hh:mm"    queryMode="single"  width="100"></t:dgCol>
   <t:dgCol title="审核意见"  field="auditContent"    queryMode="single"  width="100"></t:dgCol>
   <t:dgCol title="操作" field="opt" width="160"></t:dgCol>
   <t:dgFunOpt  funname="editItemDetail({'编辑'},{'consumeMeterialStockInController.do?goUpdate'},id,{'480'},{'350'})" title="编辑" exp="applyState_value#eq#0,3" />
   <t:dgFunOpt  funname="showItemDetail({'查看'},{'consumeMeterialStockInController.do?goUpdate'},id,{'480'},{'350'})" title="查看"  />
   <t:dgDelOpt title="删除" url="consumeMeterialStockInController.do?doDel&id={id}" exp="applyState_value#eq#0,3"/>
   <t:dgFunOpt funname="submitApply(id)" title="提交申请" exp="applyState_value#eq#0,3"></t:dgFunOpt> 
   <t:dgToolBar title="录入" icon="icon-add" url="consumeMeterialStockInController.do?goAdd" funname="add" height="350" width="480"></t:dgToolBar>
   <t:dgToolBar title="导入" icon="icon-put" funname="ImportXls"></t:dgToolBar> 
   <t:dgToolBar title="下载导入模板" icon="icon-putout" funname="ExportXlsTemplate"></t:dgToolBar> 
   </t:datagrid>
  </div>
 </div>
  <script type="text/javascript">
 $(document).ready(function(){
 	//给时间控件加上样式
 	$("#dictGroupListtb").find("input[name='createDate']").attr("class","Wdate").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
 });
 
 function submitApply(id){
		$.dialog.confirm('确定要提交申请吗?', function(r) {
			   if (r) { 
					$.ajax({
						url : 'consumeMeterialStockInController.do?submit&id='+id,
						type : 'post', 
						cache : false,
						success : function(data) {
							var d = $.parseJSON(data);
							if (d.success) {
								var msg = d.msg; 
								reloadTable(); 
							} 
							tip(d.msg); 
						}
					});
				}
			});
	}
 
//导入
 function ImportXls() {
 	openuploadwin('Excel导入', 'consumeMeterialStockInController.do?upload', "dictGroupList");
 }   
 
 //导出模板
 function ExportXlsTemplate() {
 	JeecgExcelExport("consumeMeterialStockInController.do?exportXlsTemplate","dictGroupList");
 }
 
 </script>